package com.example.run.teacherhelper.Activities;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.TextView;

import com.example.run.teacherhelper.Adapters.Student_info_Adapter;
import com.example.run.teacherhelper.R;
import com.example.run.teacherhelper.module.Student;

import java.util.ArrayList;
import java.util.List;

public class DianMingActivity extends AppCompatActivity {
    private ListView mlistView;
    private TextView activityName;//在toolbar中显示活动名称
    private Student_info_Adapter adapter;
    private List<Student> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dian_ming);
        initData();
        initView();
        setOnListener();
    }
    public void initView(){
        mlistView=(ListView)findViewById(R.id.student_list);
        activityName=(TextView)findViewById(R.id.tv_tool_name);
        activityName.setText("学生名单");
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);

        adapter = new Student_info_Adapter(this,list,dm.widthPixels);
        //ListView
        mlistView.setAdapter(adapter);
    }
    protected void initData(){
        list=new ArrayList<Student>();
        Student student1=new Student("12345","宋江");
        Student student2=new Student("12346","卢俊义");
        Student student3=new Student("12347","吴用");
        Student student4=new Student("12348","林冲");
        list.add(student1);
        list.add(student2);
        list.add(student3);
        list.add(student4);
    }
    public void setOnListener(){

    }
}
